cc.Class({
    extends: cc.Component,
    properties: {
        starPrefab:cc.Prefab,
        long:cc.Prefab,
        maxStarDuration:0,
        minStarDuration:0,
        ground:cc.Node,
        player:cc.Node,
        score:cc.Label,
    },
    onLoad () {
        this.num=0;
        this.groundY=this.ground.y+this.ground.height/2;
        this.spawnNewStar();
        var l=cc.instantiate(this.long);
        this.node.addChild(l);
        // l.setPosition(this.getNewStarPosition());
    },
    spawnNewStar:function(){
        var newStar=cc.instantiate(this.starPrefab);
        this.node.addChild(newStar);
        newStar.setPosition(this.getNewStarPosition());
        newStar.getComponent('Star').game=this;
    },
    getNewStarPosition:function(){
        var randY=this.groundY+Math.random()*this.player.getComponent('Player').jumpHeight+50;
        var maxX=this.node.width/2;
        return cc.v2((Math.random()-0.5)*2*maxX,randY);
    },
    start () {
    },
});
